#include <sigel/ISigel.h>

sGAME
{
	debug::startlog();
	Init(1024,768,32,2);
	AppTitle("2.ManyObjects");

	VWait(0);//disable vsync
	CameraHelper ch; //add camera helper.

	TFont *fnt = new TFont("tahoma.txt"); //loading texture font

	Surface *cube = new Surface();
	cube->MakeSphere(4,26); //make sphere with 4 radius and 26 segments
	
	Texture *tex = new Texture("k6.jpg",TF_MIPMAP | TF_ANISOTROPIC);
	for(int i=0;i<1;++i)
	{
		for(int j=0;j<1;++j)
		{
			Entity *c = new Entity(cube);
			c->Position(i*10,0,j*10);
			c->BindTex(tex,0);

			char buff[80];
			sprintf(buff,"i=%d j=%d",i,j);
			AppTitle(buff);
		}
	}
	

	int a = 6;

	Entity *light = new Entity(new Light()); //add light

	ch.SetMoveSmooth(0); //disable smooth moving

	ch.GetCam()->Position(0,100,0);
	ch.GetCam()->Point(100,100,200);

	float dt = 0;

	while(!KeyDown(VK_ESCAPE))
	{
		dt = GetFrameTime(); // frametime is foatvalue of ms
		ch.SetMoveSpeed(dt*0.05f); //set camera helper speed. 50 \ sec
		//3d

		ch.Update(); //update camera helper position
		Render(); 
		//2d


		fnt->Text(GetFPS(),10,10);
		fnt->Text(RenderedTris(),10,30); //draw count rendered tris
		fnt->Text(RenderedVerts(),10,50); //draw count rendered vertices

		Flip();
	}

	DeInit();
	debug::endlog();
};